<tr>
						<td class="admin_cell" valign="middle">
							Site Background:<br><br>
							<?php 
								$item['bg_path'] = "";
								if($item['bg'] != "")
								{
									$result = mysql_query('SELECT * FROM '.DB_PERFIX.'backgrounds WHERE id='.$item['bg'].' LIMIT 1;');
									if(mysql_num_rows($result) > 0)
									{
										while($row = mysql_fetch_array($result))
										{
											$item['bg_path'] = $row['path'];
										}
									}
								}
							?>
							<?php 
								if($item['bg_path'] != "")
								{
									$size = getimagesize(BGS_PATH.$item['bg_path']); 
									$fp = fopen(BGS_PATH.$item['bg_path'], "rb");
									if ($size && $fp) 
									{
										echo $size[0]." x ";
										echo $size[1]." px ";
									}
								}
								if($item['bg'] != '')
								{
									$result = mysql_query('SELECT * FROM '.DB_PERFIX.'backgrounds WHERE id='.$item['bg'].';');
									while($row = mysql_fetch_array($result))
									{$item['bg_path'] = $row['path'];}
								}
							?>
						</td>
						<td class="admin_cell"  colspan="2">
							<table width="100%" cellpadding="0" cellspacing="0" border="0">
								<tr>
									<td width="120" align="left" valign="middle">
										<?php if ($item['bg']): ?>
										<img src="<?php echo BGS_THUMB_URL; if($item['bg'] != ""){ echo $item['bg_path']; }else{ echo $item['bg']; }?>">
										<?php else: ?>
											No bg image selected
										<?php endif; ?>
									</td>
									<td align="left" width="110" valign="top" style="border-left:1px grey dotted;">
										<table cellpadding="0" cellspacing="0" border="0">
											<tr>
												<td class="admin_cell" align="left">BG-Repeat XY:</td>
												<td align="left"><input <?php if (substr_count($item['bg_style'],'repeat;') > 0){echo 'checked';} ?> type="radio" name="bg_style" value="background-repeat:repeat; "></td>
											</tr>
											<tr>
												<td class="admin_cell" align="left">BG-No repeat:</td>
												<td align="left"><input <?php if (substr_count($item['bg_style'],'no-repeat;') > 0){echo 'checked';} ?> type="radio" name="bg_style" value="background-repeat:no-repeat; "></td>
											</tr>
											<tr>
												<td class="admin_cell" align="left">BG-Fixed:</td>
												<td align="left"><input <?php if (substr_count($item['bg_style'],'attachment:fixed;') > 0){echo 'checked';} ?> type="radio" name="bg_style" value="background-attachment:fixed; "></td>
											</tr>
										</table>
									</td>
									<td align="left" valign="top" width="110">
										<table cellpadding="0" cellspacing="0" border="0">
											<tr>
												<td class="admin_cell" align="left">BG-Repeat-X:</td>
												<td align="left"><input type="radio" name="bg_style" <?php if (substr_count($item['bg_style'],'repeat-x;') > 0){echo 'checked';} ?> value="background-repeat:repeat-x; "></td>
											</tr>
											<tr>
												<td class="admin_cell" align="left">BG-Repeat-Y:</td>
												<td align="left"><input type="radio" name="bg_style" <?php if (substr_count($item['bg_style'],'repeat-y;') > 0){echo 'checked';} ?> value="background-repeat:repeat-y; "></td>
											</tr>
										</table>
									</td>
									<td align="left" valign="top" width="110" style="border-left:1px grey dotted;">
										<table cellpadding="0" cellspacing="0" border="0">
											<tr>
												<td class="admin_cell" align="left">BG-Left:</td>
												<td align="left"><input type="radio" name="bg_style_pos" <?php if (substr_count($item['bg_style'],' left') > 0){echo 'checked';} ?> value=" left "></td>
											</tr>
											<tr>
												<td class="admin_cell" align="left">BG-Centered:</td>
												<td align="left"><input type="radio" name="bg_style_pos" <?php if (substr_count($item['bg_style'],' center') > 0){echo 'checked';} ?> value=" center "></td>
											</tr>
											<tr>
												<td class="admin_cell" align="left">BG-Right:</td>
												<td align="left"><input type="radio" name="bg_style_pos" <?php if (substr_count($item['bg_style'],' right') > 0){echo 'checked';} ?> value=" right "></td>
											</tr>
										</table>
									</td>
									<td align="left" valign="top">
										<table cellpadding="0" cellspacing="0" border="0">
											<tr>
												<td class="admin_cell" align="left">BG-Top:</td>
												<td align="left"><input type="radio" name="bg_style_posv"  <?php if (substr_count($item['bg_style'],' top') > 0){echo 'checked';} ?> value=" top "></td>
											</tr>
											<tr>
												<td class="admin_cell" align="left">BG-Middle:</td>
												<td align="left"><input type="radio" name="bg_style_posv"  <?php if (substr_count($item['bg_style'],' center') > 0){echo 'center';} ?> value=" center "></td>
											</tr>
											<tr>
												<td class="admin_cell" align="left">BG-Bottom:</td>
												<td align="left"><input type="radio" name="bg_style_posv"  <?php if (substr_count($item['bg_style'],' bottom') > 0){echo 'checked';} ?> value=" bottom "></td>
											</tr>
										</table>
									</td>
									<td align="left" valign="top">
										<table cellpadding="0" cellspacing="0" border="0">
											<tr>
												<td colspan="2" class="admin_cell" align="center" valign="top">Hex Color Code</td>
											</tr>
											<tr>
												<td class="admin_cell" align="left" valign="bottom"><input id="site_bg_color" size="7" maxlength="7" type="text" name="site_bg_color" onChange="document.getElementById('site_bg_color').style.backgroundColor=this.value" value="<?php echo substr($item['bg_style'],strpos($item['bg_style'],'#'),7); ?>"></td>
												<td><a onClick="document.getElementById('js_palette').style.display='block';"><img src="../images/system/color_picker.jpg" border="0"></a></td>
											</tr>
											<tr>
												<td colspan="2" id="selected_color" style="height:24px;"  align="left">
													<div id="js_palette" style="display:none; position:absolute; top:600px; right:0px;">
														<table width="180" height="180" cellpadding="0" cellspacing="0" border="0">
															<tr>
																<td onClick="document.getElementById('js_palette').style.display='none';">
																	<?php include 'palette.php'; ?>
																</td>
															</tr>
														</table>
													</div>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td class="admin_cell" width="150">Upload New:<br></td>
						<td class="admin_cell" colspan="2">
							<input type="file" name="bg_image">&nbsp;&nbsp;Name: 
							<input name="bg_image_name" type="text" maxlength="30" value=""> <input type="submit" value="Upload">&nbsp; 
							<input type="button" value="Select from library" onClick="bg_panel.style.display='block'; dragdrop_panel.style.display='none';" style="font-weight: normal;);"/>
							<?php echo $ImageStatus." ".$error; ?>
						</td>
					</tr>
					<tr>
						<td></td>
						<td colspan="2">
							<div id="bg_panel" style="display:none;">
							<table width="100%" border="0" cellspacing="0">
								<tr>
								<?php 
									$result = mysql_query("SELECT * FROM ".DB_PERFIX."backgrounds;");
									$i = 0;
									while($row = mysql_fetch_array($result))
									{
										$output='<td width="110px" align="left" style="padding-right:10px; padding-bottom:10px;">';
										$output=$output.'<a href="?con=2&amp;item='.$item['id'].'&set_bg='.$row['id'].'">';
										$output=$output.'<img border="0" src="'.BGS_URL.'thumbs/'.$row['path'].'" width="100px"></a></td>';
										echo $output;
										$i++;
										if(($i % 4) == 0)
										{
											echo '</tr><tr>';
										}
									}
								?>
								</tr>
							</table>
							<input type="button" value="Hide lib" onClick="bg_panel.style.display='none';" style="font-weight: normal;);"/>
							</div>
							<input type="hidden" name="bg" value="<?php echo $item['bg']; ?>" />
						</td>
					</tr>